package io;
import java.io.*;
import java.text.SimpleDateFormat;

public class FileTest {
    public static void main(String[] args) {
        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        //c:/Users/Administrator/Desktop/m
        //File f=new File("C:\\Users\\Administrator\\Desktop\\mybatis-2.exe");
        File f=new File("E:\\总部资料-2020");
        //文件的全部信息
        System.out.println("是否存在?"+f.exists());
        System.out.println("文件的路径:"+f.getAbsolutePath());
        System.out.println("文件名:"+f.getName());
        System.out.println("上级:"+f.getParent());
        System.out.println("大小:"+f.length());//差异
        System.out.println("是文件?"+f.isFile());
        System.out.println("是文件夹?"+f.isDirectory());
        System.out.println("是否隐藏?"+f.isHidden());
        System.out.println("最后修改时间:"+f.lastModified());
        System.out.println("最后修改时间:"+df.format(f.lastModified()));
        System.out.println("文件能修改?"+f.canWrite());
    }
}
